Skip to content

fix: preserve feature numbering during reinitialization - #5101

Merged
mnriem merged 1 commit into
github:mainfrom
Shubham-Padkonde:fix/5098-preserve-feature-numbering
Oct 26, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
Shubham-Padkonde:fix/5098-preserve-feature-numbering

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Description

Fixes #5098. Re-running specify init --here --force currently replaces a project's feature_numbering: "timestamp" with "sequential". Preserve the existing setting, defaulting to sequential only when it is absent. Fresh initialization still uses sequential numbering.

The regression test exercises real offline initialization and re-initialization for timestamp, sequential, and missing settings. It also verifies that a custom option survives while the current here option is updated.

Testing

  • Tested locally with this checkout's .venv/Scripts/specify --help.
  • Installed test dependencies with uv sync --extra test and ran the affected tests using this checkout's virtualenv.
  • Tested with a sample project.

On Windows with Python 3.14.6:

  • Before the fix, the timestamp regression fails; the sequential and missing-setting controls pass. After the fix, all three pass.
  • .venv/Scripts/python -m pytest tests/specify_cli/test_command_init.py tests/test_branch_numbering.py -q: 20 passed, 3 shell-dependent tests skipped.
  • .venv/Scripts/python -m pytest tests/integrations/test_cli.py -k 'not symlink' -q: 70 passed, 1 skipped, 5 deselected, 2 failed. Both failures occur in fixture setup at os.symlink with Windows error 1314 (missing symlink privilege), before exercising the changed code. The unrestricted integration run encounters the same privilege limitation. The full repository suite was not run.
  • Initialized an offline generic sample, selected timestamp numbering, and re-initialized it. The setting remained timestamp. Codex then followed the generated specification command instructions for a local-notes export feature, producing a timestamp-prefixed feature directory, specification, checklist, and matching .specify/feature.json.
  • git diff --check passes. Ruff reports the same eight existing findings in command_init.py on the unchanged base and this branch; the test file has no findings.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance

AI disclosure: OpenAI Codex (GPT-6), operating autonomously on behalf of Shubham-Padkonde, investigated the issue, generated the code and tests, ran validation and the sample workflow, and drafted this PR. A more specific model variant/reasoning setting is not exposed to the agent. This disclosure does not claim personal line-by-line human review.

Assisted-by: Codex (model: GPT-6, autonomous)
@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Oct 25, 2026
@mnriem
mnriem requested a max review from Copilot October 26, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix meets the stated requirements and has targeted before-and-after regression evidence.

No open issues 🎉

What changed in this PR

Preserves feature-numbering configuration when Specify CLI reinitializes a project, addressing #5098 while retaining sequential numbering for fresh initialization.

Changes:

  • Reuse the existing feature_numbering value, defaulting to sequential only when absent.
  • Add offline regression coverage for timestamp, sequential, and missing settings, including custom-option preservation and here updates.

Validation included a dependency-free option-selection check. CLI tests were not rerun; before-and-after regression results were provided in the PR.

File Description
tests/​specify_cli/​test_command_init.py Adds parametrized reinitialization regression coverage.
src/​specify_cli/​command_init.py Preserves the saved feature-numbering setting.

Review effort: Max

@mnriem
mnriem merged commit 600eba9 into github:main Oct 26, 2026
16 checks passed
@mnriem

mnriem commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Re-running specify init --here --force resets feature_numbering in init-options.json to "sequential"

3 participants